Skip to content

[PHPUnit120] Skip mocks stored in a property in CreateStubOverCreateMockArgRector - #842

Open
harrismalik wants to merge 1 commit into
rectorphp:mainfrom
harrismalik:harrismalik/fix-9966-escaping-mock
Open

harrismalik wants to merge 1 commit into
rectorphp:mainfrom
harrismalik:harrismalik/fix-9966-escaping-mock

Conversation

@harrismalik

Copy link
Copy Markdown

Part of rectorphp/rector#9966

The rule turned createMock() into createStub() even when the mock ends up in a property and gets expects() later. It now keeps createMock() when the argument goes to a $this-> or parent:: method that assigns it to a property, and when it is an item of an array assigned to a property.

The three skip_*_stored_in_* fixtures fail without the change. The other two new fixtures guard existing behavior. composer complete-check passes with a raised memory limit.

The foreach ([$a, $b] as $mock) case from the issue is still converted by this rule. Reusing isEscapingToAlias() from #823 would break the handle_assigned_variable* fixtures, so I left it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant